package thread;

import java.util.Scanner;

public class Demo24 {
    public static void main(String[] args) {
            Object locker=new Object();
            Object locker2=new Object();
            Thread t1=new Thread(()->{
                try {
                    Thread.sleep(1000);
                    System.out.println("wait 之前");
                    synchronized (locker){
                        locker.wait();
                    }
                }catch (InterruptedException e){
                    throw new RuntimeException(e);
                }
            });
            Thread t2=new Thread(()->{
                Scanner scanner=new Scanner(System.in);
                System.out.println("输入任意内容唤醒t1");
                scanner.nextInt();
                synchronized (locker){
                    locker.notify();
                }
            });
            t1.start();
            t2.start();
    }
}
